﻿namespace housingsafety.server.Models
{
    /// <summary>
    /// 文件路径
    /// </summary>
    public class FilePath
    {
        /// <summary>
        /// 构造
        /// </summary>
        public FilePath()
        {

        }

        /// <summary>
        /// 构造
        /// </summary>
        /// <param name="relativelyStorePath">文件存储相对路径</param>
        public FilePath(string relativelyStorePath)
        {
            RelativelyStorePath = relativelyStorePath;
        }

        /// <summary>
        /// 文件存储相对路径
        /// </summary>
        public string RelativelyStorePath { get; set; }

        /// <summary>
        /// 相等
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            var fp = obj as FilePath;
            if (ReferenceEquals(null, fp))
            {
                return false;
            }

            return string.Equals(RelativelyStorePath, fp.RelativelyStorePath);
        }

        /// <summary>
        /// hash
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            var sp = RelativelyStorePath;
            return sp.GetHashCode();
        }
    }
}
